package mirrormonkey.core.server;

import mirrormonkey.core.member.SearchKey;
import mirrormonkey.framework.entity.StaticEntityData;
import mirrormonkey.framework.entity.SyncEntity;

public abstract class MappingStackElement {

	public static enum FindMode {
		EXACT, FIRST_COMPATIBLE
	};

	public static enum FailMode {
		NONE, INCOMPATIBLE
	};

	protected final MappingStack stack;

	protected MappingStackElement prev;

	protected MappingStackElement next;

	public MappingStackElement(MappingStack stack) {
		this.stack = stack;
	}

	public abstract MappingStackElement find(
			Class<? extends SyncEntity> connectedClass, FindMode find,
			FailMode fail);

	public abstract boolean exists();

	public abstract MappingStackElement addRef(boolean override,
			SearchKey search);

	public abstract MappingStackElement removeRef();

	public abstract MappingStackElement cutTop();

	public abstract MappingStackElement cutBottom();

	public abstract MappingStackElement destroy();

	public abstract boolean matchesExactly(
			Class<? extends SyncEntity> connectedClass);

	public abstract boolean matchesSubclass(
			Class<? extends SyncEntity> connectedClass);

	public abstract boolean matchesSuperclass(
			Class<? extends SyncEntity> connectedClass);

	public abstract StaticEntityData getStaticData();

}
